#include<bits/stdc++.h>
using namespace std;
long long n,a[500005][5],dp[500005][5],ans;
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			scanf("%d",&a[i][j]);
			for(int l=1;l<=3;l++)
				if(l!=j)
					dp[i][j]=max(dp[i-1][l],dp[i][j]);
			dp[i][j]+=a[i][j]; 
		}
	}
	for(int l=1;l<=3;l++)
		ans=max(dp[n][l],ans);
	printf("%d",ans);
	return 0;
}

